# coding:UTF-8
import time;
import threading

s3 = "name is %s";
s4 = "name is {}";

for i in range(2):
    time.sleep(1)
    print(s3 % "jack")
    print(s4.format("jack4"))
threadlock = threading.Lock();


class threadd(threading.Thread):
    name = "";

    def __init__(self, name):
        threading.Thread.__init__(self)
        self.name = name;

    def run(self):
        threadlock.acquire()
        for i in range(0, 10):
            print(self.name + ",i==" + str(i))
        threadlock.release();


tt = threadd("thread-1");
tt2 = threadd("thread-2");
tt3 = threadd("thread-3");
tt.start();
tt2.start();
tt3.start();
l = [];
l.append(tt)
l.append(tt2)
l.append(tt3)
threadlock.acquire()
for i in l:
    i.join()
    print(i.getName() + "," + str(i.isDaemon()))
threadlock.release();
print("end--" + __name__ + "," + threading.current_thread().getName())

# // 多线程，同步锁
